home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group02b.txt
/
000077_icon-group-sender_Fri Oct 18 17:06:53 2002.msg
< prev
next >
Wrap
Internet Message Format
|
2003-01-02
|
2KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id g9J06oc29339
for icon-group-addresses; Fri, 18 Oct 2002 17:06:51 -0700 (MST)
Message-Id: <200210190006.g9J06oc29339@baskerville.CS.Arizona.EDU>
X-Zen-Trace: 62.3.105.86
From: Robert Parlett <r.parlett@zen.co.uk>
To: "Boulet, Dan" <BouleDa@navcanada.ca>,
"IconGroup (E-mail)" <icon-group@cs.arizona.edu>,
"Unicon Group (E-mail)" <unicon-group@lists.sourceforge.net>
Subject: Re: [Unicon-group] recursive generators
Date: Fri, 18 Oct 2002 22:33:13 +0100
User-Agent: KMail/1.4.1
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
On Friday 18 October 2002 8:30 pm, Boulet, Dan wrote:
> This is an appeal to all experts in recursive generation. Given the
> following string:
>
> astring :=
> "[main],a,b,c,d,[a],a1,[b],b1,b2,[c],c1,c2,c3,[d],1,2,3,[a1],a11,a12,a13,[b
>1 ],b11,b12,b13,b14,[b2],b21,b22,b23,b24,[a11],x,y,z"
>
> Does anyone have any ideas on how the following sub-strings can be
> generated:
>
> main,a,a1,a11,x
> main,a,a1,a11,y
> main,a,a1,a11,z
> main,a,a1,a12
> main,a,a1,a13
> main,b,b1,b11
> main,b,b1,b12
> main,b,b1,b13
> main,b,b1,b14
> main,b,b2,b21
> main,b,b2,b22
> main,b,b2,b23
> main,b,b2,b24
> main,c,c1
> main,c,c2
> main,c,c3
> main,d,1
> main,d,2
> main,d,3
>
> note that:
> main points to a,b,c
> a points to a1
> a1 points to a11,a12,a13
> a11 points to x,y,z
> b points to b1,b2
> etc ...
>
>
> Regards,
>
> Daniel J. Boulet
> NAV CANADA
> Systems Test Specialist
> C113-4
> (613) 248-7221
If you do put your string into a convenient data structure (eg a table of
lists), then the generator is very simple
Hope this helps.
procedure generate_lines(t, s)
if member(t, s) then
suspend s || "," || generate_lines(t, !t[s])
else
return s
end
procedure get_table()
local t
t := table()
t["main"] := ["a","b","c","d"]
t["a"] := ["a1"]
t["b"] := ["b1","b2"]
t["c"] := ["c1","c2","c3"]
t["d"] := ["1","2","3"]
t["a1"] := ["a11","a12","a13"]
t["b1"] := ["b11","b12","b13","b14"]
t["b2"] := ["b21","b22","b23","b24"]
t["a11"] := ["x","y","z"]
return t
end
procedure main()
every write(generate_lines(get_table(), "main"))
end